#include "MOD_DEV_HEADER.h"

void do_SKILL 		(Client *me, char tail[TAILSIZE]);
//void do_SBAN		(Client *me, char tail[TAILSIZE]);
//void do_SUNBAN		(Client *me, char tail[TAILSIZE]);
//void do_SDROP		(Client *me, char tail[TAILSIZE]);
//void do_SNOTICE		(Client *me, char tail[TAILSIZE]);

/* entry */
void aures_init (Module* module)
{ 
	MODULE_NAME		(module,	"Admin Commands"				);
	MODULE_VERSION	(module,	"1.0 beta"						);
	MODULE_DESC		(module,	"Server administrators commands");
	MODULE_AUTHOR	(module, 	"Goundy"						);

	AddCommand ("skill",   do_SKILL, LEVEL_ADM);	
//	AddCommand ("sban",    do_SBAN, LEVEL_ADM);
//	AddCommand ("sunban",  do_SUNBAN, LEVEL_ADM);
//	AddCommand ("sdrop",   do_SDROP, LEVEL_ADM);
//	AddCommand ("snotice", do_SNOTICE, LEVEL_ADM);
}


/* clean up */
void aures_cleanup (void)
{
	DelCommand ("skill");
	//DelCommand ("sban");
	//DelCommand ("sunban");
	//DelCommand ("sdrop");
	//DelCommand ("snotice");
}

void do_SKILL (Client *me, char tail[TAILSIZE])
/*
	SKILL <nick> <reason>
*/
{
	Client *usr = NULL;
	char reason[REASONSIZE],
		 skillnick[NICKSIZE];
	int gard;

	gard = sscanf (tail, "%16s %32[^\n]", skillnick, reason);
	if (gard != 2){
		gard = SendToUser (me->id, "%d %s", ENUM_400, EBADREQUEST);
			if (gard == -2){
				do_KILL (me, "broken pipe");
			}
			if (gard == -1)
				printf("error send()\n");
	}
	else
	{
		if (me->status != SERVERADMIN){
			gard = SendToUser (me->id, "%d %s", ENUM_429, EARENTADMIN);
				if (gard == -2){
					do_KILL (me, "broken pipe");
				}
				if (gard == -1)
					printf("error send()\n");
		}
		else
		{
			usr = Htb_SearchUser (userstb, skillnick);
			if (usr == NULL){
				gard = SendToUser (me->id, "%d %s", ENUM_401, ENOSUCHNICK);
					if (gard == -2){
						do_KILL (me, "broken pipe");
					}
					if (gard == -1)
						printf("error send()\n");
			}
			else
			{
				do_KILL (usr, reason);
			}
		}
	}
}


